package br.com.lucasddaniel.merchanmobile.activities;

import java.util.List;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ListView;
import br.com.lucasddaniel.merchanmobile.R;
import br.com.lucasddaniel.merchanmobile.adapter.PacotesRelatorioAdapter;
import br.com.lucasddaniel.merchanmobile.bean.PacoteArquivoBean;
import br.com.lucasddaniel.merchanmobile.bean.PasseioBean;
import br.com.lucasddaniel.merchanmobile.dao.ExcessaoBanco;
import br.com.lucasddaniel.merchanmobile.Controller;

public class RelatorioPacotes extends Activity {

    private ListView lvPacotes;
    private PacotesRelatorioAdapter pacoteAdapter;
    private List<PacoteArquivoBean> listPacotes;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_relatorio_pacote);

        Integer idPasseio = getIntent().getExtras().getInt("idPasseio");
        PasseioBean pb = new PasseioBean();
        pb.setId(idPasseio);
        try {
            listPacotes = Controller.getInstance().buscarPacotes(pb, getApplicationContext());
        } catch (ExcessaoBanco e) {
            e.printStackTrace();
        }
        initializeComponents();
    }

    private void initializeComponents() {
        lvPacotes = (ListView) findViewById(R.id_activity_listar_pacotes.listview);
        pacoteAdapter = new PacotesRelatorioAdapter(getApplicationContext(), R.layout.row_pacotes_relatorio, listPacotes);
        lvPacotes.setAdapter(pacoteAdapter);
    }
}
